package work6;

/**
 * @TODO
 * @Author xu
 * 2025/2/28
 */
public class Student {
    private String name;  // 姓名
    private int age;      // 年龄
    private String gender; // 性别

    // 构造方法
    public Student(String name, int age, String gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    // Getter 和 Setter 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    // 显示所有属性的方法
    public void show() {
        System.out.println("姓名: " + name);
        System.out.println("年龄: " + age);
        System.out.println("性别: " + gender);
    }

    // 学习的方法
    public void study() {
        System.out.println(name + " 正在学习。");
    }

}
